//
//  MZMuseumCell.m
//  民族文化宫
//
//  Created by WANG CUNRUI on 14-5-24.
//  Copyright (c) 2014年 WANG CUNRUI. All rights reserved.
//

#import "MZMuseumCell.h"

@implementation MZMuseumCell
{
    NSMutableArray *titleArray;
    NSMutableArray *pointArrary;
    NSMutableArray *youPointArray;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        //self.contentView.backgroundColor = [UIColor colorWithColorGreen]
        self.contentView.backgroundColor = [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1.0];

    titleArray = [[NSMutableArray alloc] initWithObjects:@"镇馆之宝", @"民族面具", @"典藏文献",@"民俗服饰", nil];
    //pointArrary = [[NSMutableArray alloc] initWithObjects:@"2673", @"1869", @"1327", nil];
    //youPointArray = [[NSMutableArray alloc] initWithObjects:@"800", @"100000", @"600", nil];
        for(int i=0; i<3; i++)
        {
            UIView *backView = [[UIView alloc] init];
            backView.layer.cornerRadius = 3;
            UIButton *duiBut = [UIButton buttonWithType:UIButtonTypeCustom];
            if(i == 0)
            {
                backView.frame = CGRectMake(9.5, 10, 97.5, 180);
                duiBut.frame = CGRectMake(9.5, 10, 97.5, 180);
            }
            else
            {
                backView.frame = CGRectMake(9.5+5*i+97.5*i, 10, 97.5, 180);
                duiBut.frame = CGRectMake(9.5+5*i+97.5*i, 10, 97.5, 180);
            }
            backView.backgroundColor = [UIColor whiteColor];
            [self.contentView addSubview:backView];
            
            UILabel *pointLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 97.5, 20)];
            //NSString *pointStr = [pointArrary objectAtIndex:i];
            //pointLable.text = [NSString stringWithFormat:@"兑换积分%@",pointStr];
            //pointLable.backgroundColor = [UIColor colorWithRed:213/255.0 green:213/255.0 blue:213/255.0 alpha:1.0];
            pointLable.textColor = [UIColor blackColor];
            pointLable.font = [UIFont systemFontOfSize:10];
            pointLable.textAlignment = NSTextAlignmentCenter;
            [backView addSubview:pointLable];
            
            UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"pointImage%d.png",i+1]]];
            imageView.frame = CGRectMake(10, 25, 80, 70);
            [backView addSubview:imageView];
            
            UILabel *titleLable = [[UILabel alloc] init];
            titleLable.frame = CGRectMake(5, 105, 85, 30);
            titleLable.font = [UIFont systemFontOfSize:10];
            titleLable.numberOfLines = 0;
            titleLable.lineBreakMode = NSLineBreakByCharWrapping;
            titleLable.textColor = [UIColor blackColor];
            NSString *str1 = [titleArray objectAtIndex:i];
            titleLable.text = str1;
            [backView addSubview:titleLable];
            
//            UILabel *youPointLable = [[UILabel alloc] init];
//            youPointLable.frame = CGRectMake(5, 135, 88, 15);
//            youPointLable.font = [UIFont systemFontOfSize:9];
//            youPointLable.textColor = [UIColor colorWithRed:186/255.0 green:70/255.0 blue:21/255.0 alpha:1.0];
//            NSString *str2 = [youPointArray objectAtIndex:i];
//            youPointLable.text = [NSString stringWithFormat:@"您兑换积分%@",str2];
//            [backView addSubview:youPointLable];
            
//            UILabel *butLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 150, 97.5, 30)];
//            butLable.text = @"兑换";
//            butLable.textColor = [UIColor whiteColor];
//            butLable.backgroundColor = [UIColor colorWithRed:186/255.0 green:70/255.0 blue:21/255.0 alpha:1.0];
//            butLable.font = [UIFont boldSystemFontOfSize:15];
//            butLable.textAlignment = NSTextAlignmentCenter;
//            [backView addSubview:butLable];
//            
            
            duiBut.backgroundColor = [UIColor clearColor];
            duiBut.tag = i+1;
            [duiBut addTarget:self action:@selector(changeClick:) forControlEvents:UIControlEventTouchUpInside];
            [self.contentView addSubview:duiBut];
            
            backView.clipsToBounds = YES;
            
        }
        
    }
    return self;
}

//- (void)changeClick:(UIButton *)but
//{
//    NSLog(@"兑换页面兑换按钮%ld",(long)but.tag);
//    [[NSNotificationCenter defaultCenter] postNotificationName:@"usePointDetailShow" object:nil];
//}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}







@end
